package vehicle;

public class Train extends Vehicle{
	private boolean highSpeed;

	public Train() {
		super();
	}
	public Train(String name, double speed, boolean highSpeed) {
		super(name, speed);
		this.highSpeed = highSpeed;
	}
	public boolean isHighSpeed() {
		return highSpeed;
	}
	public void setHighSpeed(boolean highSpeed) {
		this.highSpeed = highSpeed;
	}
	@Override
	public double getReachTime(double distance) {
		System.out.println((highSpeed ? "高铁":"普快") + this.getName() + "火车速度为" + this.getSpeed()
		    + "公里/小时，到达" + distance + "公里需要" + distance / this.getSpeed() +"小时");
		return distance / this.getSpeed();
	}
}
